/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.guet.careapp.pojo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author LXM
 */
@Entity
@Table(name = "t_company_info")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TCompanyInfo.findAll", query = "SELECT t FROM TCompanyInfo t"),
    @NamedQuery(name = "TCompanyInfo.findByCId", query = "SELECT t FROM TCompanyInfo t WHERE t.cId = :cId"),
    @NamedQuery(name = "TCompanyInfo.findByCname", query = "SELECT t FROM TCompanyInfo t WHERE t.cname = :cname"),
    @NamedQuery(name = "TCompanyInfo.findByPhone", query = "SELECT t FROM TCompanyInfo t WHERE t.phone = :phone"),
    @NamedQuery(name = "TCompanyInfo.findByRemark", query = "SELECT t FROM TCompanyInfo t WHERE t.remark = :remark"),
    @NamedQuery(name = "TCompanyInfo.findByAddress", query = "SELECT t FROM TCompanyInfo t WHERE t.address = :address")})
public class TCompanyInfo implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "c_id")
    private Integer cId;
    @Size(max = 30)
    @Column(name = "cname")
    private String cname;
    // @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="电话/传真格式无效, 应为 xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
    @Size(max = 20)
    @Column(name = "phone")
    private String phone;
    @Size(max = 255)
    @Column(name = "remark")
    private String remark;
    @Size(max = 255)
    @Column(name = "address")
    private String address;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cInfoId")
    private Collection<TUserHomeservePeopleInfo> tUserHomeservePeopleInfoCollection;
    @JoinColumn(name = "legal_info_id", referencedColumnName = "leagal_id")
    @ManyToOne(optional = false)
    private TCompanyLeagalPeopleInfo legalInfoId;

    public TCompanyInfo() {
    }

    public TCompanyInfo(Integer cId) {
        this.cId = cId;
    }

    public Integer getCId() {
        return cId;
    }

    public void setCId(Integer cId) {
        this.cId = cId;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @XmlTransient
    public Collection<TUserHomeservePeopleInfo> getTUserHomeservePeopleInfoCollection() {
        return tUserHomeservePeopleInfoCollection;
    }

    public void setTUserHomeservePeopleInfoCollection(Collection<TUserHomeservePeopleInfo> tUserHomeservePeopleInfoCollection) {
        this.tUserHomeservePeopleInfoCollection = tUserHomeservePeopleInfoCollection;
    }

    public TCompanyLeagalPeopleInfo getLegalInfoId() {
        return legalInfoId;
    }

    public void setLegalInfoId(TCompanyLeagalPeopleInfo legalInfoId) {
        this.legalInfoId = legalInfoId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cId != null ? cId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TCompanyInfo)) {
            return false;
        }
        TCompanyInfo other = (TCompanyInfo) object;
        if ((this.cId == null && other.cId != null) || (this.cId != null && !this.cId.equals(other.cId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.TCompanyInfo[ cId=" + cId + " ]";
    }
    
}
